]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Ensure the connection list is sorted after rename
authorBenjamin Berg <bberg@redhat.com>
Mon, 13 Feb 2017 13:52:23 +0000 (14:52 +0100)
committerBenjamin Berg <bberg@redhat.com>
Wed, 15 Feb 2017 21:49:07 +0000 (22:49 +0100)
Items were inserted correctly but the synchronisation was lost if the
name of a connection was changed. Simply making sure the position is
correct after a connection is updated fixes the issue.

Reported-by: Oliver Haessler <ohaessle@redhat.com>
https://bugzilla.gnome.org/show_bug.cgi?id=778686

js/ui/status/network.js

index 835c315f65ecbfed85ffc7a68ffefae51ba7f45e..72f973a6a712798c9471efddf24b521ecf8f8d7b 100644 (file)
@@ -299,11 +299,22 @@ const NMConnectionSection = new Lang.Class({
 
         let item = this._connectionItems.get(connection.get_uuid());
         if (item)
-            item.updateForConnection(connection);
+            this._updateForConnection(item, connection);
         else
             this._addConnection(connection);
     },
 
+    _updateForConnection: function(item, connection) {
+        let pos = this._connections.indexOf(connection);
+
+        this._connections.splice(pos, 1);
+        pos = Util.insertSorted(this._connections, connection, Lang.bind(this, this._connectionSortFunction));
+        this._labelSection.moveMenuItem(item.labelItem, pos);
+        this._radioSection.moveMenuItem(item.radioItem, pos);
+
+        item.updateForConnection(connection);
+    },
+
     _addConnection: function(connection) {
         let item = this._makeConnectionItem(connection);
         if (!item)